import type { AddPark, addRentParams, BuilderData, BuilderParams, Datum, DetailBuildData, EnterpriseDetail, IndustryList, newBuilderParams, ParkParams, ParkPriseData, RentBuilder } from "@/types/park";
import service, { request } from "@/utils/reuqest";

// 获取园区企业列表
export const getParkList = (params: ParkParams) => {
return request<ParkPriseData>('/park/enterprise','get',params)
};
// 获取行业列表
export const getIndustryList = () => {
return request<IndustryList[]>('/park/industry','get')
};

// 添加园区企业
export const addPark = (params:AddPark) => {
return request('/park/enterprise','post',params)
};
// 删除企业
export const delPark = (id:number) => {
return request(`/park/enterprise/${id}`,'delete')
};
// 查看企业
export const getParkDetail = (id:string) => {
return request<EnterpriseDetail>(`/park/enterprise/${id}`,'get')
};
// 添加合同
export const addParkRent = (params:addRentParams) => {
return request('/park/enterprise/rent','post',params)
};
/**
 * 合同下载
 * @param {*} id
 * @returns
 */
export const downloadContractAPI = (id: number) => {
    return service.request<null, Blob>({
        method: 'get',
        url:`/download/${id}`,
        responseType: 'blob'
    })
  }

// 可租赁楼宇列表
export const getBuildingList = () => {
return request<RentBuilder[]>('/park/rent/building','get')
};
// 编辑企业
export const editPark = (params:AddPark) => {
return request('/park/enterprise','put',params)
};
//园区管理-企业租赁信息列表-展开查看
export const getRentDetail = (id:number) => {
return request<Datum[]>(`/park/enterprise/rent/${id}`)
};
// 删除合同
export const DelRentQ=(id:string)=>{
    return request(`/park/enterprise/rent/${id}`,'delete')
}
// 园区管理-退租租赁合同
export const over=(id:string)=>{
    return request(`/park/enterprise/rent/${id}`,'put')
}
// 楼宇管理
// 获取楼宇列表
export const getBuilding=(params:BuilderParams)=>{
    return request<BuilderData>('/park/building','get',params)
}
// xin新增楼宇
export const addBuilding=(params:newBuilderParams)=>{
    return request('/park/building','post',params)
}
// 查看楼宇详情
export const getBuildingDetail=(id:number)=>{
    return request<DetailBuildData>(`/park/building/${id}`,'get')
}
// 修改楼宇
export const editBuilding=(params:DetailBuildData)=>{
    return request('/park/building','put',params)
}
// 删除楼宇
export const delBuilding=(id:number)=>{
    return request(`/park/building/${id}`,'delete')
}